package com.hispot.download;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by ASUS-PC on 2016/11/13.
 */

public class FileDownloadSQLiteHelper extends SQLiteOpenHelper {

    public static final String SQL_NAME = "HiSpotDownload.db";

    public FileDownloadSQLiteHelper() {
        super(FileDownloader.CONTEXT, SQL_NAME, null, 1);
    }

    public FileDownloadSQLiteHelper(Context context) {
        super(context, SQL_NAME, null, 1);
    }

    public FileDownloadSQLiteHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("create table if not exists " + FileDownloadConstant.TABLE_NAME + "(" +
                FileDownloadConstant.ID + " integer primary key autoincrement," +
                FileDownloadConstant.START_POINT + " bigint," +
                FileDownloadConstant.TOTAL + " bigint," +
                FileDownloadConstant.DOWNLOAD_URL + " text not null," +
                FileDownloadConstant.DOWNLOAD_STATUS + " integer)");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
